package cn.iocoder.yudao.module.trade.dal.mysql.lifecircle;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.trade.controller.admin.lifecircle.vo.LifeCircleStorePageReqVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.lifecircle.LifeCircleStoreDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface LifeCircleStoreMapper extends BaseMapperX<LifeCircleStoreDO> {

    default PageResult<LifeCircleStoreDO> selectPage(LifeCircleStorePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LifeCircleStoreDO>()
                .likeIfPresent(LifeCircleStoreDO::getName, reqVO.getName())
                .eqIfPresent(LifeCircleStoreDO::getPhone, reqVO.getPhone())
                .eqIfPresent(LifeCircleStoreDO::getAreaId, reqVO.getAreaId())
                .eqIfPresent(LifeCircleStoreDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(LifeCircleStoreDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(LifeCircleStoreDO::getId));
    }

    default List<LifeCircleStoreDO> selectListByStatus(Integer status) {
        if (status == null) {
            return selectList();
        }
        return selectList(LifeCircleStoreDO::getStatus, status);
    }

}




